
#include "iostream"
#include "vector"
#include "unordered_map"
#include "algorithm"
#include "string"
#include "list"
class Solution{
public:
};
bool is_huiwen(int n){
    int ws=1;
    int ncpy=n;
    while(n){
        ws*=10;
        n/=10;
    }
    n=ncpy;
    ws/=10;
    while(ws>1){
        int head=n/ws;
        int rear=n%10;
        if(rear!=head){
            return false;
        }
        n%=ws;
        n/=10;
        ws/=100;
    }
    return true;
}
bool is_huiwen2(int n){
    int ws=1;
    int ncpy=n;
    while(n){
        ws*=2;
        n/=2;
    }
    n=ncpy;
    ws/=2;
    while(ws>1){
        int head=n/ws;
        int rear=n%2;
        if(rear!=head){
            return false;
        }
        n%=ws;
        n/=2;
        ws/=4;
    }
    return true;
}

int main() {
//    std::list<int> list1;
//    int c=0;int b=0;
////    bool first= true;
    int a;
//    std::string max;
//    std::string s;
    while(std::cin>>a){
        printf((is_huiwen(a)&& is_huiwen2(a))?"Yes\n":"No\n");
    }
    return 0;
}

